Fix bug 515 by adding a global lock around the hotplug scripts in the non-udev hotplu...
authorharry@localhost.localdomain <harry@localhost.localdomain>
Fri, 24 Mar 2006 13:31:20 +0000 (14:31 +0100)
committerharry@localhost.localdomain <harry@localhost.localdomain>
Fri, 24 Mar 2006 13:31:20 +0000 (14:31 +0100)
There are two possible root causes for 515, both of which are only problems in the non-udev hotplug case because udev uses udevsend which already implements the required serialisation.

1) Script concurrency.
2) Kernel reordering hotplug events.

This changeset fixes (1) but not (2).  Since (1) is the problem that seems to be happening this is probably OK.

A fix for (2) for the hotplug case might be to add extra serialisation using state changes in the store but this would impact all the drivers and the code and extra complexity would be redundant once everyone had moved to udev.  This doesn't seem worthwhile unless we actually start to see (2) happening.

tools/examples/xen-backend.agent

index 72bbafda21b5af5f34f45855f0838c719030568a..e662015da24fcbe96131a69885ac1fa5b1e62c6b 100755 (executable)
@@ -2,6 +2,10 @@
 
 PATH=/etc/xen/scripts:$PATH
 
+. /etc/xen/scripts/locking.sh
+
+claim_lock xenbus_hotplug_global
+
 case "$XENBUS_TYPE" in
   vbd)
     /etc/xen/scripts/block "$ACTION"
@@ -25,3 +29,5 @@ case "$ACTION" in
   offline)
     ;;
 esac
+
+release_lock xenbus_hotplug_global